using System;
using System.Collections.Generic;
using System.Text;
using Shc.Sql;
using Shc.Json;
namespace CLZ.Data
{
	public static class TableBusinessType
	{
		public const string Table = "BusinessType";
		public const string BusinessTypeID = "BusinessTypeID";
		public const string BusinessTypeName = "BusinessTypeName";
		public const string Description = "Description";
		public const string Sort = "Sort";
	}
	
	[Serializable]
	public class BaseBusinessType
		: IDbSessionEntity, IJsonClass
	{
		int m_BusinessTypeID;
		/// <summary>
        /// 
        /// </summary>
        public int BusinessTypeID
        {
            get { return m_BusinessTypeID; }
            set { m_BusinessTypeID = value; }
        }
		
		string m_BusinessTypeName;
		/// <summary>
        /// 
        /// </summary>
        public string BusinessTypeName
        {
            get { return m_BusinessTypeName; }
            set { m_BusinessTypeName = value; }
        }
		
		string m_Description;
		/// <summary>
        /// 
        /// </summary>
        public string Description
        {
            get { return m_Description; }
            set { m_Description = value; }
        }
		
		int m_Sort;
		/// <summary>
        /// 
        /// </summary>
        public int Sort
        {
            get { return m_Sort; }
            set { m_Sort = value; }
        }
		
		
		#region IDbSessionEntity Members
		public void ReadDBData(RowDataReader reader)
        {
            m_BusinessTypeID = reader[TableBusinessType.BusinessTypeID];
            m_BusinessTypeName = reader[TableBusinessType.BusinessTypeName];
            m_Description = reader[TableBusinessType.Description];
            m_Sort = reader[TableBusinessType.Sort];
        }
		
		public void WriteDBData(RowDataWriter writer)
        {
            writer.SetPrimaryKey(TableBusinessType.BusinessTypeID, PrimaryKeyType.Identity, BusinessTypeID);
			writer[TableBusinessType.BusinessTypeName] = BusinessTypeName;
			writer[TableBusinessType.Description] = Description;
			writer[TableBusinessType.Sort] = Sort;
        }

        public void SetIdentityAfterInsert(DBObject idd)
        {
            m_BusinessTypeID = idd;
        }
		
		public string TableName
        {
            get { return TableBusinessType.Table; }
        }
		#endregion
		
		#region IJsonClass Members

        public void JsonDeSerializeObj(JsonHashTable hashToRead)
        {
             m_BusinessTypeID = hashToRead["BusinessTypeID"];
			 
             m_BusinessTypeName = hashToRead["BusinessTypeName"];
			 
             m_Description = hashToRead["Description"];
			 
             m_Sort = hashToRead["Sort"];
			 
        }

        public void JsonSerializeObj(JsonHashTable hashToFill)
        {
            hashToFill["BusinessTypeID"] = BusinessTypeID;
			 
            hashToFill["BusinessTypeName"] = BusinessTypeName;
			 
            hashToFill["Description"] = Description;
			 
            hashToFill["Sort"] = Sort;
			 
        }

        #endregion
		
	}
}
